package com.datastructure.test.differentnumberofpath;

public class DifferentNumberOfPath {

    int result = 0;
    public static void main(String[] args) {
        DifferentNumberOfPath differentNumberOfPath = new DifferentNumberOfPath();
        differentNumberOfPath.uniquePaths(2,2);
    }

    public int uniquePaths (int m, int n) {
        // write code here
        if(m==0&n==0){
            return 0;
        }
        getUniquePaths(0,0,m-1,n-1);
        return result;
    }

    private void getUniquePaths(int i, int j, int m, int n) {
        if(i==m&&j==n){
            result++;
        }
        if(i<=m){
          getUniquePaths(i+1,j,m,n);
        }
        if(j<=n){
            getUniquePaths(i,j+1,m,n);
        }
    }
}
